﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UnitTestUtils.DB
{
    class TableMock<TEntity> : ITable<TEntity>
        where TEntity : class
    {
        private List<TEntity> _list;

        #region Construction / Deconstruction
        public TableMock()
        {
            _list = new List<TEntity>();
        }

        public TableMock(IEnumerable<TEntity> collection)
        {
            _list = new List<TEntity>(collection);
        }
        #endregion

        #region ITable<TEntity> Members

        public System.Data.Linq.DataContext Context
        {
            get { throw new NotImplementedException(); }
        }

        public bool IsReadOnly { get; set; }

        public void Attach(TEntity entity)
        {
            throw new NotImplementedException();
        }

        public void Attach(TEntity entity, bool asModified)
        {
            throw new NotImplementedException();
        }

        public void Attach(TEntity entity, TEntity original)
        {
            throw new NotImplementedException();
        }

        public void AttachAll<TSubEntity>(IEnumerable<TSubEntity> entities) where TSubEntity : TEntity
        {
            throw new NotImplementedException();
        }

        public void AttachAll<TSubEntity>(IEnumerable<TSubEntity> entities, bool asModified) where TSubEntity : TEntity
        {
            throw new NotImplementedException();
        }

        public void DeleteAllOnSubmit<TSubEntity>(IEnumerable<TSubEntity> entities) where TSubEntity : TEntity
        {
            throw new NotImplementedException();
        }

        public void DeleteOnSubmit(TEntity entity)
        {
            throw new NotImplementedException();
        }

        public IEnumerator<TEntity> GetEnumerator()
        {
            return _list.GetEnumerator();
        }

        public System.Data.Linq.ModifiedMemberInfo[] GetModifiedMembers(TEntity entity)
        {
            throw new NotImplementedException();
        }

        public System.ComponentModel.IBindingList GetNewBindingList()
        {
            throw new NotImplementedException();
        }

        public TEntity GetOriginalEntityState(TEntity entity)
        {
            throw new NotImplementedException();
        }

        public void InsertAllOnSubmit<TSubEntity>(IEnumerable<TSubEntity> entities) where TSubEntity : TEntity
        {
            throw new NotImplementedException();
        }

        public void InsertOnSubmit(TEntity entity)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _list.GetEnumerator();
        }

        #endregion

        #region IQueryable Members

        public Type ElementType
        {
            get { throw new NotImplementedException(); }
        }

        public System.Linq.Expressions.Expression Expression
        {
            get { throw new NotImplementedException(); }
        }

        public IQueryProvider Provider
        {
            get { throw new NotImplementedException(); }
        }

        #endregion

        #region IQueryProvider Members

        public IQueryable<TElement> CreateQuery<TElement>(System.Linq.Expressions.Expression expression)
        {
            throw new NotImplementedException();
            //return Queryable.AsQueryable<TElement>(_list.AsEnumerable<TElement>());
        }

        public IQueryable CreateQuery(System.Linq.Expressions.Expression expression)
        {
            throw new NotImplementedException();
        }

        public TResult Execute<TResult>(System.Linq.Expressions.Expression expression)
        {
            throw new NotImplementedException();
        }

        public object Execute(System.Linq.Expressions.Expression expression)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
